% This program is a copy of AnalyseCharactersiticsEditorsJournal.m but the computation of the editorial board characteristics includes the data (only the data not related to the articles published by the editor) of the editors who have homonyms
ValueFolder='/sps/isc/rneveu/EtudeIRM/Nature/Results/';
ValueFolderTemp='/sps/isc/rneveu/EtudeIRM/Nature/ResultsJournal/';
ValueFolderTemp2='/sps/isc/rneveu/EtudeIRM/Nature/ResultsEditor/';
load([ValueFolderTemp 'ResultsThirdLevelDistributionOutliers.mat']);
VecDistribution=VecResults;
ValueFolder2='/sps/isc/rneveu/EtudeIRM/Nature/';
load([ValueFolder2 'DonneesNature.mat']);
load([ValueFolder2 'EtudeNature.mat']);
VecEditors1Temp(1,:)=[];
ValueCutoff=1.25;
VecResultsEditor1=[];
VecResultsEditor2=[];
VecResultsEditor3=[];
n61=0;
VecResultsExperience=[];
VecResultsExperience2=[];
VecResultsExperience3=[];
VecResultsExperience4=[];
for n1=1:33
    n1
    VecResultsJournalEditor=[];
    VecResultsTemp=[];
    n5=0;
    n6=0;
    for n2=1:323
        ValueTemp=find(VecDistribution(:,1)==n2);
        if n2~=11&&size(ValueTemp,1)==1&&VecDistribution(ValueTemp(1,1),2)<=ValueCutoff
            ValueTemp=dir([ValueFolderTemp2 'FileAnalysisCharacteristicsEditor' num2str(n2) '.mat']);
            if size(ValueTemp,1)==1
                load([ValueFolderTemp2 'FileAnalysisCharacteristicsEditor' num2str(n2) '.mat']); 
            end
            if VecResultsEditor(1,39)==n1
                VecResultsJournalEditor=[VecResultsJournalEditor;VecResultsEditor(1,1:38)];
                n61=n61+1;
                if strcmp(VecEditors1Temp{n2,13},'N')==1
                    VecResultsTemp=[VecResultsTemp;1];
                    VecResultsEditor1=[VecResultsEditor1;VecResultsEditor(1,13) VecResultsEditor(1,23) VecResultsEditor(1,3)];
                    VecResultsExperience=[VecResultsExperience;VecResultsEditor(1,16)];
                else
                    if strcmp(VecEditors1Temp{n2,13},'Y')==1
                        VecResultsTemp=[VecResultsTemp;0];
                        VecResultsEditor2=[VecResultsEditor2;VecResultsEditor(1,13) VecResultsEditor(1,23) VecResultsEditor(1,3)];
                        VecResultsExperience2=[VecResultsExperience2;VecResultsEditor(1,16)];
                    else
                        VecResultsTemp=[VecResultsTemp;-1];
                        VecResultsExperience2=[VecResultsExperience2;VecResultsEditor(1,16)];
                    end
                end
            end
        else
            if n2~=11&&size(ValueTemp,1)==1
                ValueTemp=dir([ValueFolderTemp2 'FileAnalysisCharacteristicsEditor' num2str(n2) '.mat']);
                load([ValueFolderTemp2 'FileAnalysisCharacteristicsEditor' num2str(n2) '.mat']);
                if VecResultsEditor(1,39)==n1
                    VecResultsJournalEditor=[VecResultsJournalEditor;NaN(1,12) VecResultsEditor(1,13) NaN(1,2) VecResultsEditor(1,16) NaN(1,10) VecResultsEditor(1,27) NaN(1,11)];
                    n61=n61+1;
                    if strcmp(VecEditors1Temp{n2,13},'N')==1
                        VecResultsTemp=[VecResultsTemp;1];
                        VecResultsExperience3=[VecResultsExperience3;VecResultsEditor(1,16)];
                    else
                        if strcmp(VecEditors1Temp{n2,13},'Y')==1
                            VecResultsTemp=[VecResultsTemp;0];
                            VecResultsExperience4=[VecResultsExperience4;VecResultsEditor(1,16)];
                        else
                            VecResultsTemp=[VecResultsTemp;-1];
                            VecResultsExperience4=[VecResultsExperience4;VecResultsEditor(1,16)];
                        end
                    end
                end
            end
        end
    end
    if size(VecResultsJournalEditor,1)>0
        ValueTemp=find(VecResultsTemp==1);
        ValueTemp2=find(VecResultsTemp==0);
        ValueTemp3=find(VecResultsTemp==-1);
        if size(VecResultsJournalEditor,1)>1
            VecResultsJournalEditorTemp=nanmean(VecResultsJournalEditor);
%             VecResultsJournalEditorTemp=nanmedian(VecResultsJournalEditor);
            VecResultsJournalEditorTemp2=sum(1-isnan(VecResultsJournalEditor));
        else
            VecResultsJournalEditorTemp=VecResultsJournalEditor;
            VecResultssJournalEditorTemp2=1-isnan(VecResultsJournalEditor);
        end
        VecResultsJournalEditor=[VecResultsJournalEditorTemp size(ValueTemp,1)/size(VecResultsTemp,1)*100 size(ValueTemp2,1)/size(VecResultsTemp,1)*100 size(ValueTemp3,1)/size(VecResultsTemp,1)*100 size(VecResultsJournalEditor,1) VecResultsJournalEditorTemp2 size(VecResultsTemp,1) size(VecResultsTemp,1) size(VecResultsTemp,1)];
    else
        VecResultsJournalEditor=[NaN(1,41) zeros(1,42)];
    end
    save([ValueFolderTemp 'FileAnalysisCharacteristicsEditorsResearchJournal' num2str(n1) '.mat']);
end
VecResults=[];
[ValueResults,ValueResults2]=ttest2(VecResultsExperience,VecResultsExperience2);
[ValueResults3,ValueResults4]=ranksum(VecResultsExperience,VecResultsExperience2);
VecResults=[VecResults;nanmean(VecResultsExperience) sqrt(nanvar(VecResultsExperience)) nanmean(VecResultsExperience2) sqrt(nanvar(VecResultsExperience2)) ValueResults2 ValueResults3];
[ValueResults,ValueResults2]=ttest2([VecResultsExperience;VecResultsExperience3],[VecResultsExperience2;VecResultsExperience4]);
[ValueResults3,ValueResults4]=ranksum([VecResultsExperience;VecResultsExperience3],[VecResultsExperience2;VecResultsExperience4]);
VecResults=[VecResults;nanmean([VecResultsExperience;VecResultsExperience3]) sqrt(nanvar([VecResultsExperience;VecResultsExperience3])) nanmean([VecResultsExperience2;VecResultsExperience4]) sqrt(nanvar([VecResultsExperience2;VecResultsExperience4])) ValueResults2 ValueResults3];